﻿<?php 
include_once("../../includes/metodos.php");
include_once("action.php");

checkUser();
connectSql();
isAdmin();

if(!empty($_REQUEST['cmd']) && $_REQUEST['cmd']=='del'){
	remove(anti_injection($_REQUEST['id']));
}
include("../cabecalho.php");
?>
<body>
 <div id="fundo">
   <div id="conteudo">
	<div id="meio">
	    <div style="margin: 0 auto; width:800px;">
				 <p id="p_busca">Busca</p><br><br><br>
				 <form action="">
				 <input id="form_pesquisa" value="" type="search"/><a href="#"><img style="float:left; margin:4px 0 0 10px" src="../img/busca.png"></a>
				 </form><br><br><br>
				    <div style="width:706px;margin:0 auto;overflow:hidden;"><label id="label_noticia">Usu&aacute;rio</label>
				    <input id="nova_noticia" type="button" onclick="location.href='<?php echo EXTERNAL_ROOT_PORTAL;?>/admin/usuarios/new.php';" value="Novo">
				    </div>
				    <table style="margin:0 auto;">
				      <tr  id="tabela">
				        <td id="tabela" width=500px;><Strong id="strong_titulo">E-mail</Strong></td>
				        <td id="tabela" width=75px><Strong id="strong_estilo1">Status</Strong></td>
				        <td id="tabela" width=92px;><Strong id="strong_estilo2">A&ccedil;&atilde;o</Strong></td>
				      </tr>
				      <?php 
				      $targetpage = "index.php";
				      $tableName = "econ_usuarios";
				      $ordem = 'ORDER BY id DESC';
				       
			          $limit = 20;
			          include_once '../../paginacao/index.php';
			          
				      echo '<div><label style="font: italic bold 12px arial,helvetica,sans-aerif;margin:0 0 15px 0;">'.$total_pages.' Resultados</label></div>';
				      echo $paginate.'<br/>';
				      $cont = 1;
				      while($row = mysql_fetch_array($result)){
							$link = "javascript:decision('Deseja excluir o usu&aacute;rio?', 'index.php?cmd=del&id=".$row['id']."')";
							echo '<tr><td id="tabela" width=406px;>'.utf8_encode($row['email']).'</td>';
							if($row['status']==1){
								echo '<td id="tabela" width=64px; style="color: green;"><img src="../img/icon_ativo.png"><label>&nbsp;Ativo</label></td>';
							}else{
								echo '<td id="tabela" width=64px; style="color: red;"><img src="../img/icon_inativo.png"><label>&nbsp;Inativo</label></td>';
							}
							echo '<td id="tabela" width=92px;;><a style="float:left;" href="edit.php?id='.$row['id'].'">Editar</a>
									<a style="float:right; margin-right: 5px;" href="'.$link.'">Deletar</a></td></tr>';
						}	      
				      ?>
				    </table>
					
					<?php echo '<br/>'.$paginate; ?>
		</div>			
	    
	</div>
	
	<div id="rodape">Copyright &copy; 2011 Econometrix. Todos os direitos reservados. Rua Osvaldo Cruz, 2860 - Dionisio Torres - Cep:60125-151 - Fone (85) 3246.7878
	</div>
   </div>
 </div>
</body>

</html>